package cn.codewen.shop.service.impl;

import cn.codewen.shop.dao.AdminDao;
import cn.codewen.shop.dao.impl.AdminDaoImpl;
import cn.codewen.shop.pojo.Admin;
import cn.codewen.shop.service.AdminService;

public class AdminServiceImpl implements AdminService {
    //0. 创建adminDao对象
    private AdminDao adminDao = new AdminDaoImpl();

    @Override
    public Admin checkAdmin(String username, String password) {
        //1. 通过username找到admin对象
        Admin admin = adminDao.getOneByUsername(username);
        //2. 判断admin是否存在
        if (admin != null && admin.getPassword().equals(password)) {
            return admin;
        } else {
            return null;
        }
    }


}
